set1={1,2,3}
print(set1)
print(type(set1))
set2={}
print(type(set2))
set3= set()
print(type(set3))


s1={'a','b','c','d'}
print(s1) # 每次运行都不一样，数字一样（哈希表）

s2={1,2,3,4,5,1,2,3}
print(s2) # {1, 2, 3, 4, 5}

# 集合操作

# 添加元素
print('=========================')
ss1={1,2,3,4}
# print(ss1)
# ss1.add(5)
# print(ss1)

# ss1.update('567')
# ss1.update({"name":'dd','age':22})
# print(ss1)

# 删除元素
ss2={1,2,3,4}
ss3={'a','b','c','d'}
# ss2.remove(3)
# print(ss2)

# ss2.remove(5)
# print(ss2)

# ss2.pop()
# print(ss2) # 第一个
#
# ss3.pop()
# print(ss3) # 随机

ss2.discard(3)
print(ss1)
ss2.discard(9)
print(ss1)

print('=========================')
a={1,2,3,4}
b={3,4,5,6}
c={7,8,9,10}
print(a&b) # {3, 4}
print(a&c) # set()

print(a|b) # {1, 2, 3, 4, 5, 6}
